﻿// #define DEBUG_GRID_SHOW

using System.Collections;
using System.Collections.Generic;
using System.IO;

namespace PathFind.Algo {
    public interface IaStarAlgo {
        void ReInitData(short width, short height);
        void ReInitData(BitArray gd, short width, short height);
        void PreProcessGrid();
        void ReProcessGrid(short lx, short rx, short ty, short by);
        void WriteDataToFile(BinaryWriter fout);
        void WritePreDataToFile(BinaryWriter fout);
        // void WriteDataToBytes();
        void ReadDataFromFile(BinaryReader fin);
        void ReadPreDataFromFile(BinaryReader fin);
        int MemorySize();
        bool HasPreprocessedMap();
        bool FindSolution(short sX, short sY, short eX, short eY, ref List<Coordinate> solution);
        Coordinate[] FindSolution2(short sX, short sY, short eX, short eY);
        bool IsCoordinateBlocked(Coordinate c);
        void AddNaturalNeighbours(ref DirectionSet neighSet, Direction dir);
        void AddForcedNeighbours(ref DirectionSet neighSet, ref Coordinate pos, Direction dir);
        bool HasForcedNeighbours(ref Coordinate pos, Direction dir);

        void SetCanWalkState(Coordinate co, bool canWalk);
        void SetPassable(short x, short y, bool canWalk);
        bool IsPassable(Coordinate co);
        bool IsPassable(int index);
        bool IsPassable(short x, short y);

        bool InBounds(Coordinate co);
        bool InBounds(int index);
        bool InBounds(short x, short y);
        short GetHeight();
        short GetWidth();
        string DumpTxtMapData();
#if DEBUG_GRID_SHOW
        void SetGrid(SquireGrid squireGrid);
        IEnumerator FindSolution(short sX, short sY, short eX, short eY);
#endif
    }
}